<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {
            name:'tom',
            age:13,
            'say address':'广西'
        }
        localStorage.setItem('lac','5656')
        localStorage.setItem('la',obj)
        localStorage.setItem('local',obj)

        // console.log(localStorage)
        // json序列化，将对象转换成字符串JSON.stringify()
        // localStorage.setItem() 向浏览器存储一个健值对
        localStorage.setItem('local',JSON.stringify(obj));
        // localStorage.getItem() 从浏览器获取某个健值对
        // localStorage.removeItem(key) 删除某个健值对
        // localStorage.clear() 清空所有健值对
        var res = localStorage.getItem('local');
        // console.log(res);
        // json反序列化，将字符串转换为对象JSON.parse()
        console.log(JSON.parse(res));
        console.log(JSON.parse(res).name);

    </script>
</body>
</html>